package controllers

import (
	"github.com/astaxie/beego"
	"analysis-ss/dt"
)

type CourseController struct {
	beego.Controller
}
func (c *CourseController) URLMapping() {
	c.Mapping("GetCourse", c.GetCourse)
}

// @Title 获取中心老师信息列表
// @Description 根据中心编号获取中心对应的老师信息
// @Param	childId		query	int	false	"孩子编号"
// @Param	courseId	query	int	false	"课程编号"
// @Param	start		query	int	true	"起始记录号"
// @Param	length		query	int	true	"每页记录数"
// @Success 200 {object} models.DataTable
// @router / [post]
func (c *CourseController) GetCourse() {

	//获得条件参数
	childId := c.GetString("childId")
	courseId := c.GetString("courseId")
	// 分页
	start, err := c.GetInt("start")
	if err != nil {
		start = 0
	}
	length, err := c.GetInt("length")
	if err != nil {
		length = 10
	}

	courses := new(dt.Course)
	err = courses.GetTableInfo(start,length,childId,courseId)
	if err !=nil{
		beego.Debug(err)
	}
	c.Data["json"] = courses
	c.ServeJSON()
}

